{% extends 'base.html' %}
{% block head %}
    {{ super() }}
    <link rel="stylesheet" href="{{ url_for('static', filename='lib/datatables/media/css/dataTables.bootstrap.min.css') }}">
{#    <link rel="stylesheet" href="{{ url_for('static', filename='lib/datatables/media/css/jquery.dataTables.min.css') }}">#}
    <link rel="stylesheet" href="{{ url_for('static', filename='lib/datatables/extensions/Buttons/css/buttons.dataTables.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='lib/datatables/extensions/Buttons/css/buttons.bootstrap.min.css') }}">
{% endblock %}
{% block title %}
    {{ title }}
{% endblock %}
{% block contentheader %}
    <h1>机房管理<small>--可以用来新增机房，修改机房</small></h1>
{% endblock contentheader %}
{% block content %}
<div class="row">

</div>
<div class="box">
<div class="box-header">
</div>
<!-- /.box-header -->
<div class="box-body">
<table id="roomTable" class="table table-bordered  table-striped justified" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>id</th>
                <th>机房名称</th>
                <th>机房地址</th>
                <th>机房管理员</th>
                <th>管理员电话</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody></tbody>
    </table>
</div>
</div>
<!-- 增加机房模态框 -->
<div class="modal fade" id="addRoom" tabindex="-1" role="dialog" aria-labelledby="addRoom">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">增加机房</h4>
      </div>
      <div class="modal-body">
        <form class="form-horizontal container-fluid" id="add-room-form" action="{{ url_for('api_dp.room') }}" method="post">
            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
            <div class="form-group">
              <label for="name" class="col-sm-3 control-label">机房名</label>

              <div class="col-sm-9">
                <input type="text" name=name class="form-control" id="name" placeholder="机房名">
              </div>
            </div>
            <div class="form-group">
              <label for="address"  class="col-sm-3 control-label">机房地址</label>

              <div class="col-sm-9">
                <input type="text" name="address" class="form-control" id="address" placeholder="机房地址">
              </div>
            </div>
            <div class="form-group">
              <label for="admin" class="col-sm-3 control-label">机房管理员</label>
              <div class="col-sm-9">
                <input type="text" name="admin" class="form-control" id="admin" placeholder="机房管理员">
              </div>
            </div>
            <div class="form-group">
              <label for="admin_phone" class="col-sm-3 control-label">管理员电话</label>
              <div class="col-sm-9">
                <input type="text" name="admin_phone" class="form-control" id="admin_phone" placeholder="管理员电话">
              </div>
            </div>
            <div class="pull-right">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="submit" id="add-room-form" class="btn btn-primary">确认</button>
            </div>
        </form>
      </div>
    </div>
  </div>
</div>

{% endblock content %}
{% block foot %}
    {{ super() }}
    <script>var ajaxUrl="{{ url_for('api_dp.roomlist') }}"; var roomUrl="{{ url_for('api_dp.room') }}"</script>
{% endblock %}